<?php 
header("content-type:text/html;charset=utf-8");
include_once("/Classes/PHPExcel.php");
$excel=PHPExcel_IOFactory::load("text.xls");
$sheet=$excel->getActiveSheet();
$rows=$sheet->getHighestRow();
$cols=$sheet->getHighestColumn();
for ($i=2; $i <=$rows ; $i++) { 
	for ($j='A'; $j <=$cols ; $j++) { 
		$data[$i-2][]=$sheet->getCell($j.$i)->getValue();
	}
}
$db=new PDO("mysql:host=127.0.0.1;dbname=zice;charset=utf8",'root','root');
foreach ($data as $key => $value) {
	$name=$value[0];
	$pwd=$value[1];
	$rname=$value[2];
	$gz=$value[3];
	$sql="insert into yuan(name,pwd,rname,gz) values('$name','$pwd','$rname','$gz')";
	$res=$db->exec($sql);
}
echo $res;









 ?>